function dologin() {
	var userName = $("#userName").val();
	if (userName == '') {
		$("#userName").focus();
		art.dialog({
			icon : 'warning',
			time : 1,
			content : "用户名不能为空"
		});
		return false;
	}
	var password = $("#password").val();
	if (password == '') {
		$("#password").focus();
		art.dialog({
			icon : 'warning',
			time : 2,
			content : "用户登录密码不能为空"
		});
		return false;
	}
	
	var datas = {
		userName : userName,
		password : hex_md5(password)
	};
	$.ajax({
		url : "/logining",
		type : 'post',
		data : datas,
		async:false, 
		dataType : "json",
		success : function(data) {
			if (data.success) {
				 var storage=window.localStorage;
				 var curTime = new Date().getTime();
		         storage.setItem("loginName",data.data.loginName);
		         storage.setItem("access_token",data.data.access_token);
		         sessionStorage.setItem('access_time', curTime);
		         window.location.href="news.html";
			} else {
				art.dialog({
					icon : 'warning',
					time : 2,
					content : data.msg
				});
			}
		}
	});

}

$(document).keyup(function(event){
	if(event.keyCode == 13){
		dologin();
	}
});